home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / kstandarddirs.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-10  |  25.6 KB  |  730 lines

  1. /*
  2.   This file is part of the KDE libraries
  3.   Copyright (C) 1999 Sirtaj Singh Kang <taj@kde.org>
  4.   Copyright (C) 1999 Stephan Kulow <coolo@kde.org>
  5.   Copyright (C) 1999 Waldo Bastian <bastian@kde.org>
  6.  
  7.   This library is free software; you can redistribute it and/or
  8.   modify it under the terms of the GNU Library General Public
  9.   License as published by the Free Software Foundation; either
  10.   version 2 of the License, or (at your option) any later version.
  11.  
  12.   This library is distributed in the hope that it will be useful,
  13.   but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.   Library General Public License for more details.
  16.  
  17.   You should have received a copy of the GNU Library General Public License
  18.   along with this library; see the file COPYING.LIB.  If not, write to
  19.   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  20.   Boston, MA 02110-1301, USA.
  21. */
  22.  
  23. #ifndef SSK_KSTDDIRS_H
  24. #define SSK_KSTDDIRS_H
  25.  
  26. #include <qstring.h>
  27. #include <qdict.h>
  28. #include <qstringlist.h>
  29. #include <kglobal.h>
  30.  
  31. class KConfig;
  32. class KStandardDirsPrivate;
  33.  
  34. /**
  35.  * @short Site-independent access to standard KDE directories.
  36.  * @author Stephan Kulow <coolo@kde.org> and Sirtaj Singh Kang <taj@kde.org>
  37.  *
  38.  * This is one of the most central classes in kdelibs as
  39.  * it provides a basic service: It knows where the files
  40.  * reside on the user's hard disk. And it's meant to be the
  41.  * only one that knows -- to make the real location as
  42.  * transparent as possible to both the user and the applications.
  43.  *
  44.  * To this end it insulates the application from all information
  45.  * and applications always refer to a file with a resource type
  46.  * (e.g. icon) and a filename (e.g. khexdit.xpm). In an ideal world
  47.  * the application would make no assumption where this file is and
  48.  * leave it up to KStandardDirs::findResource("apps", "Home.desktop")
  49.  * to apply this knowledge to return /opt/kde/share/applnk/Home.desktop
  50.  * or ::locate("data", "kgame/background.jpg") to return
  51.  * /opt/kde/share/apps/kgame/background.jpg
  52.  *
  53.  * The main idea behind KStandardDirs is that there are several
  54.  * toplevel prefixes below which the files lie. One of these prefixes is
  55.  * the one where the user installed kdelibs, one is where the
  56.  * application was installed, and one is $HOME/.kde, but there
  57.  * may be even more. Under these prefixes there are several well
  58.  * defined suffixes where specific resource types are to be found.
  59.  * For example, for the resource type "html" the suffixes could be
  60.  * share/doc/HTML and share/doc/kde/HTML.
  61.  * So the search algorithm basically appends to each prefix each registered
  62.  * suffix and tries to locate the file there.
  63.  * To make the thing even more complex, it's also possible to register
  64.  * absolute paths that KStandardDirs looks up after not finding anything
  65.  * in the former steps. They can be useful if the user wants to provide
  66.  * specific directories that aren't in his $HOME/.kde directory for,
  67.  * for example, icons.
  68.  *
  69.  * <b>Standard resources that kdelibs allocates are:</b>\n
  70.  *
  71.  * @li apps - Applications menu (.desktop files).
  72.  * @li cache - Cached information (e.g. favicons, web-pages)
  73.  * @li cgi - CGIs to run from kdehelp.
  74.  * @li config - Configuration files.
  75.  * @li data - Where applications store data.
  76.  * @li exe - Executables in $prefix/bin. findExe() for a function that takes $PATH into account.
  77.  * @li html - HTML documentation.
  78.  * @li icon - Icons, see KIconLoader.
  79.  * @li lib - Libraries.
  80.  * @li locale - Translation files for KLocale.
  81.  * @li mime - Mime types.
  82.  * @li module - Module (dynamically loaded library).
  83.  * @li qtplugins - Qt plugins (dynamically loaded objects for Qt)
  84.  * @li services - Services.
  85.  * @li servicetypes - Service types.
  86.  * @li scripts - Application scripting additions.
  87.  * @li sound - Application sounds.
  88.  * @li templates - Templates
  89.  * @li wallpaper - Wallpapers.
  90.  * @li tmp - Temporary files (specific for both current host and current user)
  91.  * @li socket - UNIX Sockets (specific for both current host and current user)
  92.  * @li emoticons - Emoticons themes  (Since KDE 3.4)
  93.  *
  94.  * A type that is added by the class KApplication if you use it, is
  95.  * appdata. This one makes the use of the type data a bit easier as it
  96.  * appends the name of the application.
  97.  * So while you had to ::locate("data", "appname/filename") so you can
  98.  * also write ::locate("appdata", "filename") if your KApplication instance
  99.  * is called "appname" (as set via KApplication's constructor or KAboutData, if
  100.  * you use the global KStandardDirs object KGlobal::dirs()).
  101.  * Please note though that you cannot use the "appdata"
  102.  * type if you intend to use it in an applet for Kicker because 'appname' would
  103.  * be "Kicker" instead of the applet's name. Therefore, for applets, you've got
  104.  * to work around this by using ::locate("data", "appletname/filename").
  105.  *
  106.  * <b>KStandardDirs supports the following environment variables:</b>
  107.  *
  108.  * @li KDEDIRS: This may set an additional number of directory prefixes to
  109.  *          search for resources. The directories should be separated
  110.  *          by ':'. The directories are searched in the order they are
  111.  *          specified.
  112.  * @li KDEDIR:  Used for backwards compatibility. As KDEDIRS but only a single
  113.  *          directory may be specified. If KDEDIRS is set KDEDIR is
  114.  *          ignored.
  115.  * @li KDEHOME: The directory where changes are saved to. This directory is
  116.  *          used to search for resources first. If KDEHOME is not
  117.  *          specified it defaults to "$HOME/.kde"
  118.  * @li KDEROOTHOME: Like KDEHOME, but used for the root user.
  119.  *          If KDEROOTHOME is not set it defaults to the .kde directory in the
  120.  *          home directory of root, usually "/root/.kde".
  121.  *          Note that the setting of $HOME is ignored in this case.
  122.  *
  123.  * @see KGlobalSettings
  124.  */
  125. class KDECORE_EXPORT KStandardDirs
  126. {
  127. public:
  128.         /**
  129.      * KStandardDirs' constructor. It just initializes the caches.
  130.      **/
  131.     KStandardDirs( );
  132.  
  133.     /**
  134.      * KStandardDirs' destructor.
  135.      */
  136.     virtual ~KStandardDirs();
  137.  
  138.     /**
  139.      * Adds another search dir to front of the @p fsstnd list.
  140.      *
  141.      * @li When compiling kdelibs, the prefix is added to this.
  142.      * @li KDEDIRS or KDEDIR is taking into account
  143.      * @li Additional dirs may be loaded from kdeglobals.
  144.      *
  145.      * @param dir The directory to append relative paths to.
  146.      */
  147.     void addPrefix( const QString& dir );
  148.  
  149.     /**
  150.      * Adds another search dir to front of the XDG_CONFIG_XXX list
  151.      * of prefixes.
  152.      * This prefix is only used for resources that start with "xdgconf-"
  153.      *
  154.      * @param dir The directory to append relative paths to.
  155.      */
  156.     void addXdgConfigPrefix( const QString& dir );
  157.  
  158.     /**
  159.      * Adds another search dir to front of the XDG_DATA_XXX list
  160.      * of prefixes.
  161.      * This prefix is only used for resources that start with "xdgdata-"
  162.      *
  163.      * @param dir The directory to append relative paths to.
  164.      */
  165.     void addXdgDataPrefix( const QString& dir );
  166.  
  167.     /**
  168.      * Adds suffixes for types.
  169.      *
  170.      * You may add as many as you need, but it is advised that there
  171.      * is exactly one to make writing definite.
  172.      * All basic types ( kde_default) are added by addKDEDefaults(),
  173.      * but for those you can add more relative paths as well.
  174.      *
  175.      * The later a suffix is added, the higher its priority. Note, that the
  176.      * suffix should end with / but doesn't have to start with one (as prefixes
  177.      * should end with one). So adding a suffix for app_pics would look
  178.      * like KGlobal::dirs()->addResourceType("app_pics", "share/app/pics");
  179.      *
  180.      * @param type Specifies a short descriptive string to access
  181.      * files of this type.
  182.      * @param relativename Specifies a directory relative to the root
  183.      * of the KFSSTND.
  184.      * @return true if successful, false otherwise.
  185.      */
  186.     bool addResourceType( const char *type,
  187.                   const QString& relativename );
  188.  
  189.     /**
  190.      * Adds absolute path at the end of the search path for
  191.      * particular types (for example in case of icons where
  192.      * the user specifies extra paths).
  193.      *
  194.      * You shouldn't need this
  195.      * function in 99% of all cases besides adding user-given
  196.      * paths.
  197.      *
  198.      * @param type Specifies a short descriptive string to access files
  199.      * of this type.
  200.      * @param absdir Points to directory where to look for this specific
  201.      * type. Non-existant directories may be saved but pruned.
  202.      * @return true if successful, false otherwise.
  203.      */
  204.     bool addResourceDir( const char *type,
  205.                  const QString& absdir);
  206.  
  207.     /**
  208.      * Tries to find a resource in the following order:
  209.      * @li All PREFIX/\<relativename> paths (most recent first).
  210.      * @li All absolute paths (most recent first).
  211.      *
  212.      * The filename should be a filename relative to the base dir
  213.      * for resources. So is a way to get the path to libkdecore.la
  214.      * to findResource("lib", "libkdecore.la"). KStandardDirs will
  215.      * then look into the subdir lib of all elements of all prefixes
  216.      * ($KDEDIRS) for a file libkdecore.la and return the path to
  217.      * the first one it finds (e.g. /opt/kde/lib/libkdecore.la)
  218.      *
  219.      * @param type The type of the wanted resource
  220.      * @param filename A relative filename of the resource.
  221.      *
  222.      * @return A full path to the filename specified in the second
  223.      *         argument, or QString::null if not found.
  224.      */
  225.     QString findResource( const char *type,
  226.                   const QString& filename ) const;
  227.  
  228.     /**
  229.      * Checks whether a resource is restricted as part of the KIOSK
  230.      * framework. When a resource is restricted it means that user-
  231.      * specific files in the resource are ignored.
  232.      *
  233.      * E.g. by restricting the "wallpaper" resource, only system-wide
  234.      * installed wallpapers will be found by this class. Wallpapers
  235.      * installed under the $KDEHOME directory will be ignored.
  236.      *
  237.      * @param type The type of the resource to check
  238.      * @param relPath A relative path in the resource.
  239.      *
  240.      * @return True if the resource is restricted.
  241.      * @since 3.1
  242.      */
  243.     bool isRestrictedResource( const char *type,
  244.                   const QString& relPath=QString::null ) const;
  245.  
  246.         /**
  247.          * Returns a number that identifies this version of the resource.
  248.          * When a change is made to the resource this number will change.
  249.          *
  250.      * @param type The type of the wanted resource
  251.      * @param filename A relative filename of the resource.
  252.      * @param deep If true, all resources are taken into account
  253.      *        otherwise only the one returned by findResource().
  254.      *
  255.      * @return A number identifying the current version of the
  256.      *          resource.
  257.      */
  258.     Q_UINT32 calcResourceHash( const char *type,
  259.                   const QString& filename, bool deep) const;
  260.  
  261.     /**
  262.      * Tries to find all directories whose names consist of the
  263.      * specified type and a relative path. So would
  264.      * findDirs("apps", "Settings") return
  265.      * @li /opt/kde/share/applnk/Settings/
  266.      * @li /home/joe/.kde/share/applnk/Settings/
  267.      *
  268.      * Note that it appends / to the end of the directories,
  269.      * so you can use this right away as directory names.
  270.      *
  271.      * @param type The type of the base directory.
  272.      * @param reldir Relative directory.
  273.      *
  274.      * @return A list of matching directories, or an empty
  275.      *         list if the resource specified is not found.
  276.      */
  277.     QStringList findDirs( const char *type,
  278.                               const QString& reldir ) const;
  279.  
  280.     /**
  281.      * Tries to find the directory the file is in.
  282.      * It works the same as findResource(), but it doesn't
  283.      * return the filename but the name of the directory.
  284.      *
  285.      * This way the application can access a couple of files
  286.      * that have been installed into the same directory without
  287.      * having to look for each file.
  288.      *
  289.      * findResourceDir("lib", "libkdecore.la") would return the
  290.      * path of the subdir libkdecore.la is found first in
  291.      * (e.g. /opt/kde/lib/)
  292.      *
  293.      * @param type The type of the wanted resource
  294.      * @param filename A relative filename of the resource.
  295.      * @return The directory where the file specified in the second
  296.      *         argument is located, or QString::null if the type
  297.      *         of resource specified is unknown or the resource
  298.      *         cannot be found.
  299.      */
  300.     QString findResourceDir( const char *type,
  301.                  const QString& filename) const;
  302.  
  303.  
  304.     /**
  305.      * Tries to find all resources with the specified type.
  306.      *
  307.      * The function will look into all specified directories
  308.      * and return all filenames in these directories.
  309.      *
  310.      * @param type The type of resource to locate directories for.
  311.      * @param filter Only accept filenames that fit to filter. The filter
  312.      *        may consist of an optional directory and a QRegExp
  313.      *        wildcard expression. E.g. "images\*.jpg". Use QString::null
  314.      *        if you do not want a filter.
  315.      * @param recursive Specifies if the function should decend
  316.      *        into subdirectories.
  317.      * @param unique If specified,  only return items which have
  318.      *        unique suffixes - suppressing duplicated filenames.
  319.      *
  320.      * @return List of all the files whose filename matches the
  321.      *         specified filter.
  322.      */
  323.     QStringList findAllResources( const char *type,
  324.                        const QString& filter = QString::null,
  325.                        bool recursive = false,
  326.                        bool unique = false) const;
  327.  
  328.     /**
  329.      * Tries to find all resources with the specified type.
  330.      *
  331.      * The function will look into all specified directories
  332.      * and return all filenames (full and relative paths) in
  333.      * these directories.
  334.      *
  335.      * @param type The type of resource to locate directories for.
  336.      * @param filter Only accept filenames that fit to filter. The filter
  337.      *        may consist of an optional directory and a QRegExp
  338.      *        wildcard expression. E.g. "images\*.jpg". Use QString::null
  339.      *        if you do not want a filter.
  340.      * @param recursive Specifies if the function should decend
  341.      *        into subdirectories.
  342.      * @param unique If specified,  only return items which have
  343.      *        unique suffixes.
  344.      * @param relPaths The list to store the relative paths into
  345.      *        These can be used later to ::locate() the file
  346.      *
  347.      * @return List of all the files whose filename matches the
  348.      *         specified filter.
  349.      */
  350.     QStringList findAllResources( const char *type,
  351.                        const QString& filter,
  352.                        bool recursive,
  353.                        bool unique,
  354.                        QStringList &relPaths) const;
  355.  
  356.     /**
  357.      * Returns a QStringList list of pathnames in the system path.
  358.      *
  359.      * @param pstr  The path which will be searched. If this is
  360.      *         null (default), the $PATH environment variable will
  361.      *        be searched.
  362.      *
  363.      * @return a QStringList list of pathnames in the system path.
  364.      */
  365.     static QStringList systemPaths( const QString& pstr=QString::null );
  366.  
  367.     /**
  368.      * Finds the executable in the system path.
  369.      *
  370.      * A valid executable must
  371.      * be a file and have its executable bit set.
  372.      *
  373.      * @param appname The name of the executable file for which to search.
  374.      * @param pathstr The path which will be searched. If this is
  375.      *         null (default), the $PATH environment variable will
  376.      *        be searched.
  377.      * @param ignoreExecBit    If true, an existing file will be returned
  378.      *            even if its executable bit is not set.
  379.      *
  380.      * @return The path of the executable. If it was not found,
  381.      *         it will return QString::null.
  382.      * @see findAllExe()
  383.      */
  384.     static QString findExe( const QString& appname,
  385.                 const QString& pathstr=QString::null,
  386.                 bool ignoreExecBit=false );
  387.  
  388.     /**
  389.      * Finds all occurrences of an executable in the system path.
  390.      *
  391.      * @param list    Will be filled with the pathnames of all the
  392.      *        executables found. Will be empty if the executable
  393.      *        was not found.
  394.      * @param appname    The name of the executable for which to
  395.      *             search.
  396.      * @param pathstr    The path list which will be searched. If this
  397.      *        is 0 (default), the $PATH environment variable will
  398.      *        be searched.
  399.      * @param ignoreExecBit If true, an existing file will be returned
  400.      *            even if its executable bit is not set.
  401.      *
  402.      * @return The number of executables found, 0 if none were found.
  403.      *
  404.      * @see    findExe()
  405.      */
  406.     static int findAllExe( QStringList& list, const QString& appname,
  407.                    const QString& pathstr=QString::null,
  408.                    bool ignoreExecBit=false );
  409.  
  410.     /**
  411.      * This function adds the defaults that are used by the current
  412.      * KDE version.
  413.      *
  414.      * It's a series of addResourceTypes()
  415.      * and addPrefix() calls.
  416.      * You normally wouldn't call this function because it's called
  417.      * for you from KGlobal.
  418.      */
  419.     void addKDEDefaults();
  420.  
  421.     /**
  422.      * Reads customized entries out of the given config object and add
  423.      * them via addResourceDirs().
  424.      *
  425.      * @param config The object the entries are read from. This should
  426.      *        contain global config files
  427.      * @return true if new config paths have been added
  428.      * from @p config.
  429.      **/
  430.     bool addCustomized(KConfig *config);
  431.  
  432.     /**
  433.      * This function is used internally by almost all other function as
  434.      * it serves and fills the directories cache.
  435.          *
  436.      * @param type The type of resource
  437.      * @return The list of possible directories for the specified @p type.
  438.      * The function updates the cache if possible.  If the resource
  439.      * type specified is unknown, it will return an empty list.
  440.          * Note, that the directories are assured to exist beside the save
  441.          * location, which may not exist, but is returned anyway.
  442.      */
  443.     QStringList resourceDirs(const char *type) const;
  444.  
  445.     /**
  446.      * This function will return a list of all the types that KStandardDirs
  447.      * supports.
  448.      *
  449.      * @return All types that KDE supports
  450.      */
  451.     QStringList allTypes() const;
  452.  
  453.     /**
  454.      * Finds a location to save files into for the given type
  455.      * in the user's home directory.
  456.      *
  457.      * @param type The type of location to return.
  458.      * @param suffix A subdirectory name.
  459.      *             Makes it easier for you to create subdirectories.
  460.      *   You can't pass filenames here, you _have_ to pass
  461.      *       directory names only and add possible filename in
  462.      *       that directory yourself. A directory name always has a
  463.       *       trailing slash ('/').
  464.      * @param create If set, saveLocation() will create the directories
  465.      *        needed (including those given by @p suffix).
  466.      *
  467.      * @return A path where resources of the specified type should be
  468.      *         saved, or QString::null if the resource type is unknown.
  469.      */
  470.      QString saveLocation(const char *type,
  471.                   const QString& suffix = QString::null,
  472.                   bool create = true) const;
  473.  
  474.         /**
  475.          * Converts an absolute path to a path relative to a certain
  476.          * resource.
  477.          *
  478.          * If "abs = ::locate(resource, rel)"
  479.          * then "rel = relativeLocation(resource, abs)" and vice versa.
  480.          *
  481.          * @param type The type of resource.
  482.          *
  483.          * @param absPath An absolute path to make relative.
  484.          *
  485.          * @return A relative path relative to resource @p type that
  486.          * will find @p absPath. If no such relative path exists, absPath
  487.          * will be returned unchanged.
  488.          */
  489.          QString relativeLocation(const char *type, const QString &absPath);
  490.  
  491.     /**
  492.      * Recursively creates still-missing directories in the given path.
  493.      *
  494.      * The resulting permissions will depend on the current umask setting.
  495.      * permission = mode & ~umask.
  496.      *
  497.      * @param dir Absolute path of the directory to be made.
  498.      * @param mode Directory permissions.
  499.      * @return true if successful, false otherwise
  500.      */
  501.     static bool makeDir(const QString& dir, int mode = 0755);
  502.  
  503.     /**
  504.      * This returns a default relative path for the standard KDE
  505.      * resource types. Below is a list of them so you get an idea
  506.      * of what this is all about.
  507.      *
  508.      * @li data - share/apps
  509.      * @li html - share/doc/HTML
  510.      * @li icon - share/icon
  511.      * @li config - share/config
  512.      * @li pixmap - share/pixmaps
  513.      * @li apps - share/applnk
  514.      * @li sound - share/sounds
  515.      * @li locale - share/locale
  516.      * @li services - share/services
  517.      * @li servicetypes - share/servicetypes
  518.      * @li mime - share/mimelnk
  519.      * @li wallpaper - share/wallpapers
  520.      * @li templates - share/templates
  521.      * @li exe - bin
  522.      * @li lib - lib
  523.      *
  524.      * @returns Static default for the specified resource.  You
  525.      *          should probably be using locate() or locateLocal()
  526.      *          instead.
  527.      * @see locate()
  528.      * @see locateLocal()
  529.      */
  530.     static QString kde_default(const char *type);
  531.  
  532.     /**
  533.      * @internal (for use by sycoca only)
  534.      */
  535.     QString kfsstnd_prefixes();
  536.  
  537.     /**
  538.      * @internal (for use by sycoca only)
  539.      */
  540.     QString kfsstnd_xdg_conf_prefixes();
  541.  
  542.     /**
  543.      * @internal (for use by sycoca only)
  544.      */
  545.     QString kfsstnd_xdg_data_prefixes();
  546.  
  547.     /**
  548.      * Returns the toplevel directory in which KStandardDirs
  549.      * will store things. Most likely $HOME/.kde
  550.      * Don't use this function if you can use locateLocal
  551.      * @return the toplevel directory
  552.      */
  553.     QString localkdedir() const;
  554.  
  555.     /**
  556.      * @internal
  557.      * Returns the default toplevel directory where KDE is installed.
  558.      */
  559.     static QString kfsstnd_defaultprefix();
  560.  
  561.     /**
  562.      * @internal
  563.      * Returns the default bin directory in which KDE executables are stored.
  564.      */
  565.     static QString kfsstnd_defaultbindir();
  566.  
  567.     /**
  568.      * @return $XDG_DATA_HOME
  569.      * See also http://www.freedesktop.org/standards/basedir/draft/basedir-spec/basedir-spec.html
  570.      */
  571.     QString localxdgdatadir() const;
  572.  
  573.     /**
  574.      * @return $XDG_CONFIG_HOME
  575.      * See also http://www.freedesktop.org/standards/basedir/draft/basedir-spec/basedir-spec.html
  576.      */
  577.     QString localxdgconfdir() const;
  578.  
  579.     /**
  580.      * Checks for existence and accessability of a file or directory.
  581.      * Faster than creating a QFileInfo first.
  582.      * @param fullPath the path to check. IMPORTANT: must end with a slash if expected to be a directory
  583.      *                 (and no slash for a file, obviously).
  584.      * @return true if the directory exists
  585.      */
  586.     static bool exists(const QString &fullPath);
  587.  
  588.     /**
  589.      * Expands all symbolic links and resolves references to
  590.      * '/./', '/../' and extra  '/' characters in @p dirname
  591.      * and returns the canonicalized absolute pathname.
  592.      * The resulting path will have no symbolic link, '/./'
  593.      * or '/../' components.
  594.      * @since 3.1
  595.      */
  596.     static QString realPath(const QString &dirname);
  597.  
  598.     /**
  599.      * Expands all symbolic links and resolves references to
  600.      * '/./', '/../' and extra  '/' characters in @p filename
  601.      * and returns the canonicalized absolute pathname.
  602.      * The resulting path will have no symbolic link, '/./'
  603.      * or '/../' components.
  604.      * @since 3.4
  605.      */
  606.     static QString realFilePath(const QString &filename);
  607.  
  608.  private:
  609.  
  610.     QStringList prefixes;
  611.  
  612.     // Directory dictionaries
  613.     QDict<QStringList> absolutes;
  614.     QDict<QStringList> relatives;
  615.  
  616.     mutable QDict<QStringList> dircache;
  617.     mutable QDict<QString> savelocations;
  618.  
  619.     // Disallow assignment and copy-construction
  620.     KStandardDirs( const KStandardDirs& );
  621.     KStandardDirs& operator= ( const KStandardDirs& );
  622.  
  623.     bool addedCustoms;
  624.  
  625.     class KStandardDirsPrivate;
  626.     KStandardDirsPrivate *d;
  627.  
  628.     void checkConfig() const;
  629.     void applyDataRestrictions(const QString &) const;
  630.     void createSpecialResource(const char*);
  631.  
  632.         // Like their public counter parts but with an extra priority argument
  633.         // If priority is true, the directory is added directly after
  634.         // $KDEHOME/$XDG_DATA_HOME/$XDG_CONFIG_HOME
  635.     void addPrefix( const QString& dir, bool priority );
  636.     void addXdgConfigPrefix( const QString& dir, bool priority );
  637.     void addXdgDataPrefix( const QString& dir, bool priority );
  638.  
  639.     // If priority is true, the directory is added before any other,
  640.     // otherwise after
  641.     bool addResourceType( const char *type,
  642.                   const QString& relativename, bool priority );
  643.     bool addResourceDir( const char *type,
  644.                  const QString& absdir, bool priority);
  645. };
  646.  
  647. /**
  648.  * \addtogroup locates Locate Functions
  649.  *  @{
  650.  * On The Usage Of 'locate' and 'locateLocal'
  651.  *
  652.  * Typical KDE applications use resource files in one out of
  653.  * three ways:
  654.  *
  655.  * 1) A resource file is read but is never written. A system
  656.  *    default is supplied but the user can override this
  657.  *    default in his local .kde directory:
  658.  *
  659.  *    \code
  660.  *    // Code example
  661.  *    myFile = locate("appdata", "groups.lst");
  662.  *    myData =  myReadGroups(myFile); // myFile may be null
  663.  *    \endcode
  664.  *
  665.  * 2) A resource file is read and written. If the user has no
  666.  *    local version of the file the system default is used.
  667.  *    The resource file is always written to the users local
  668.  *    .kde directory.
  669.  *
  670.  *    \code
  671.  *    // Code example
  672.  *    myFile = locate("appdata", "groups.lst")
  673.  *    myData =  myReadGroups(myFile);
  674.  *    ...
  675.  *    doSomething(myData);
  676.  *    ...
  677.  *    myFile = locateLocal("appdata", "groups.lst");
  678.  *    myWriteGroups(myFile, myData);
  679.  *    \endcode
  680.  *
  681.  * 3) A resource file is read and written. No system default
  682.  *    is used if the user has no local version of the file.
  683.  *    The resource file is always written to the users local
  684.  *    .kde directory.
  685.  *
  686.  *    \code
  687.  *    // Code example
  688.  *    myFile = locateLocal("appdata", "groups.lst");
  689.  *    myData =  myReadGroups(myFile);
  690.  *    ...
  691.  *    doSomething(myData);
  692.  *    ...
  693.  *    myFile = locateLocal("appdata", "groups.lst");
  694.  *    myWriteGroups(myFile, myData);
  695.  *    \endcode
  696.  **/
  697.  
  698. /*!
  699.  * \relates KStandardDirs
  700.  * This function is just for convenience. It simply calls
  701.  *instance->dirs()->\link KStandardDirs::findResource() findResource\endlink(type, filename).
  702.  **/
  703. KDECORE_EXPORT QString locate( const char *type, const QString& filename, const KInstance* instance = KGlobal::instance() );
  704.  
  705. /*!
  706.  * \relates KStandardDirs
  707.  * This function is much like locate. However it returns a
  708.  * filename suitable for writing to. No check is made if the
  709.  * specified filename actually exists. Missing directories
  710.  * are created. If filename is only a directory, without a
  711.  * specific file, filename must have a trailing slash.
  712.  *
  713.  **/
  714. KDECORE_EXPORT QString locateLocal( const char *type, const QString& filename, const KInstance* instance = KGlobal::instance() );
  715.  
  716. /*!
  717.  * \relates KStandardDirs
  718.  * This function is much like locate. No check is made if the
  719.  * specified filename actually exists. Missing directories
  720.  * are created if @p createDir is true. If filename is only
  721.  * a directory, without a specific file,
  722.  * filename must have a trailing slash.
  723.  *
  724.  **/
  725. KDECORE_EXPORT QString locateLocal( const char *type, const QString& filename, bool createDir, const KInstance* instance = KGlobal::instance() );
  726.  
  727. /*! @} */
  728.  
  729. #endif // SSK_KSTDDIRS_H
  730.